﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
//using LTP.Accounts.Bus;
namespace xxxy.Web.mettingInfo
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtmName.Text.Trim().Length==0)
			{
				strErr+="培训名称不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtmTime1.Text))
			{
				strErr+="开始时间格式错误！\\n";	
			}
			if(!PageValidate.IsDateTime(txtmtime2.Text))
			{
				strErr+="结束时间格式错误！\\n";	
			}
			if(this.txtmParticipants.Text.Trim().Length==0)
			{
				strErr+="会议参与人不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtmUpload.Text))
			{
				strErr+="上传人格式错误！\\n";	
			}
			if(!PageValidate.IsDateTime(txtmUploadTime.Text))
			{
				strErr+="上传时间格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtmStation.Text))
			{
				strErr+="状态格式错误！\\n";	
			}
			if(this.txtmAttachment.Text.Trim().Length==0)
			{
				strErr+="附件不能为空！\\n";	
			}
			if(this.txtrRemarks.Text.Trim().Length==0)
			{
				strErr+="备注不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtmaddress.Text))
			{
				strErr+="会议地址格式错误！\\n";	
			}
			if(this.txtmsummary.Text.Trim().Length==0)
			{
				strErr+="总结不能为空！\\n";	
			}
			if(this.txtmnotice.Text.Trim().Length==0)
			{
				strErr+="通知不能为空！\\n";	
			}
			if(this.txtmdata.Text.Trim().Length==0)
			{
				strErr+="资料不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string mName=this.txtmName.Text;
			DateTime mTime1=DateTime.Parse(this.txtmTime1.Text);
			DateTime mtime2=DateTime.Parse(this.txtmtime2.Text);
			string mParticipants=this.txtmParticipants.Text;
			int mUpload=int.Parse(this.txtmUpload.Text);
			DateTime mUploadTime=DateTime.Parse(this.txtmUploadTime.Text);
			int mStation=int.Parse(this.txtmStation.Text);
			string mAttachment=this.txtmAttachment.Text;
			string rRemarks=this.txtrRemarks.Text;
			DateTime maddress=DateTime.Parse(this.txtmaddress.Text);
			string msummary=this.txtmsummary.Text;
			string mnotice=this.txtmnotice.Text;
			string mdata=this.txtmdata.Text;

			xxxy.Model.mettingInfo model=new xxxy.Model.mettingInfo();
			model.mName=mName;
			model.mTime1=mTime1;
			model.mtime2=mtime2;
			model.mParticipants=mParticipants;
			model.mUpload=mUpload;
			model.mUploadTime=mUploadTime;
			model.mStation=mStation;
			model.mAttachment=mAttachment;
			model.rRemarks=rRemarks;
			model.maddress=maddress;
			model.msummary=msummary;
			model.mnotice=mnotice;
			model.mdata=mdata;

			xxxy.BLL.mettingInfo bll=new xxxy.BLL.mettingInfo();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
